package com.damon.android.interview.asynctask;

import android.os.AsyncTask;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;

/**
 * Created by Damon.Han on 2018/10/18 0018.
 *
 * @author Damon
 */
public class ImageTask extends AsyncTask<String, Integer, Void> {
    ImageView imageView;
    TextView textView;
    ProgressBar progressBar;

    @Override
    protected Void doInBackground(String... strings) {
        String url = strings[0];
        URLConnection connection;
        try {
            connection = new URL(url).openConnection();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    public ImageTask(ImageView imageView, ProgressBar progressBar, TextView textView) {
        this.imageView = imageView;
        this.textView = textView;
        this.progressBar = progressBar;
    }

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
    }

    @Override
    protected void onPostExecute(Void aVoid) {
        super.onPostExecute(aVoid);
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        super.onProgressUpdate(values);
    }

    @Override
    protected void onCancelled(Void aVoid) {
        super.onCancelled(aVoid);
    }
}
